<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});

Auth::routes();


Route::get('/home', 'HomeController@index')->name('home');

// common
Route::post('upload/image', 'UploadController@image')->name('upload.image');
Route::post('upload/attachment', 'UploadController@attachment')->name('upload.attachment');

//第三方授权登录
Route::get('oauth/{driver}', 'AuthController@redirectToProvider');
Route::get('oauth/{driver}/callback', 'AuthController@handleProviderCallback');

// 微信 网页授权回调测试
Route::get('/debug/wechat/userinfo', function () {
    $user = session('wechat.oauth_user');
    var_export($user);
    exit();
})->middleware('wechat.oauth:snsapi_userinfo');

Route::get('/debug/wechat/base', function () {
    $user = session('wechat.oauth_user');
    var_export($user);
    exit();
});
